<!-- 应收账款列表 -->
<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="项目编号" :labelCol="labelCol">
              <j-input placeholder="请输入项目编号" v-model="queryParam.xmbh"></j-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="项目名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-input placeholder="请输入项目名称" v-model="queryParam.projectName"></j-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="任务档案编号" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-input placeholder="请输入任务档案编号" v-model="queryParam.taskBillNo"></j-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="经营团队" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <select-team-input v-model="queryParam.jytd" :tdlx="1" :teamType="0"/>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="项目承接人" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <select-user-by-dep v-model="queryParam.undertaker"></select-user-by-dep>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="生产团队" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <select-team-input v-model="queryParam.productTeam" :tdlx="1" :teamType="0"/>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="项目负责人" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <select-user-by-dep v-model="queryParam.projectLeading"></select-user-by-dep>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="任务进度状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-dict-select-tag placeholder="请选择任务进度状态" v-model="queryParam.taskProgressStatus" dictCode="progress_status"/>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="年份">
              <a-date-picker
                mode="year"
                placeholder="请选择年份"
                format="YYYY"
                v-model="queryParam.statisticYear"
                style="width:100%"
                :allowClear="false"
                :open="yearShowOne"
                @openChange="openChangeOne"
                @panelChange="panelChangeOne"
              />
            </a-form-item>
          </a-col>
          <!-- <template v-if="toggleSearchStatus"></template> -->
          <a-col style="float: left;overflow: hidden;" :xl="6" :lg="7" :md="8" :sm="24">
            <span class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button @click="searchReset" icon="reload" style="margin-left: 8px;">重置</a-button>
              <!-- <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
              </a> -->
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->
    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button
        type="primary"
        icon="download"
        @click="handleExportXls(exportName)">导出
      </a-button>
    </div>
    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a
          style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>
      <a-table
        ref="table"
        size="middle"
        :components="draggableComponent"
        bordered
        rowKey="taskPlanHash"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        :loading="loading"
        class="j-table-force-nowrap"
        @change="handleTableChange">
        <a slot="projectName" slot-scope="text, record" @click="onDetail(record.projectName)">{{ record.projectName_dictText }}</a>
        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img
            v-else
            :src="getImgView(text)"
            height="25px"
            alt=""
            style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">
            下载
          </a-button>
        </template>
        <a slot="htmc" :title="text" slot-scope="text, record" @click="getDetail(record.id)">
          {{ text }}
        </a>
        <span slot="rowIndex" slot-scope="text, record, index">{{ index + 1 }}</span>
      </a-table>
    </div>
    <!-- 项目详情开始 -->
    <erp-project-report-modal ref="projectModalForm"></erp-project-report-modal>
    <!-- 项目详情结束 -->
  </a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { DisabledAuthFilterMixin } from '@/mixins/DisabledAuthFilterMixin'
import SelectCustomerInput from '@/views/scy/components/SelectCustomerInput'
import SelectTeamInput from '@/views/scy/components/SelectTeamInput'
import SelectProjectInput from '@/views/scy/components/SelectProjectInput'
import SelectUserByDep from '@/views/scy/components/SelectUserByDep'
import BusinessCategoryNameSelect from '@views/erp/components/BusinessCategoryNameSelect'
import SelectCompanyInput from '@/views/scy/components/SelectCompanyInput'
import Ellipsis from '@/components/Ellipsis'
import { getAction } from '@/api/manage'
import ErpProjectReportModal from '@/views/erp/report/project/modules/ErpProjectReportModal'
import AddressChoice from '@/components/AddressChoice/AddressChoice';
import moment from 'moment'
var statisticYear = moment().format('YYYY')
export default {
  name: 'ErpFinanceAccountsReceivableBillList',
  mixins: [JeecgListMixin, mixinDevice, DisabledAuthFilterMixin],
  components: {
    SelectCustomerInput,
    SelectTeamInput,
    SelectProjectInput,
    SelectUserByDep,
    BusinessCategoryNameSelect,
    SelectCompanyInput,
    Ellipsis,
    ErpProjectReportModal,
    AddressChoice
  },
  data() {
    return {
      // 导出名字是应收账款报表加时间戳
      exportName: '应收账款报表' + moment().format('YYYYMMDDHHmm'),
      yearShowOne: false,
      queryParam: {
        // 年份是当前年份
        statisticYear: moment(new Date()).format('YYYY')
      },
      /* 排序参数 */
      isorter: {
        column: '',
        order: ''
      },
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 19 }
      },
      description: '应收账款列表',
      // 表头
      columns: [],
      // 列设置
      settingColumns: [],
      // 列定义
      defColumns: [
        {
          title: '项目编号',
          align: 'center',
          dataIndex: 'projectFinalNo',
          ellipsis: true,
          width: 200
        },
        {
          title: '项目名称',
          align: 'center',
          dataIndex: 'projectName',
          scopedSlots: { customRender: 'projectName' },
          ellipsis: true,
          width: 220
        },
        {
          title: '业绩归属年度',
          align: 'center',
          dataIndex: 'performanceYear',
          ellipsis: true,
          width: 120
        },
        {
          title: '签订单位',
          align: 'center',
          dataIndex: 'signUnit_dictText',
          ellipsis: true,
          width: 120
        },
        {
          title: '业主单位',
          align: 'center',
          dataIndex: 'ownerUnit_dictText',
          ellipsis: true,
          width: 120
        },
        {
          title: '经营团队',
          align: 'center',
          dataIndex: 'teamName_dictText',
          ellipsis: true,
          width: 200
        },
        {
          title: '团队负责人',
          align: 'center',
          dataIndex: 'manageTeamLeader_dictText',
          ellipsis: true,
          width: 200
        },
        {
          title: '项目承接人',
          align: 'center',
          dataIndex: 'undertaker_dictText',
          ellipsis: true,
          width: 100
        },
        {
          title: '收款合同额(元)',
          align: 'center',
          dataIndex: 'estimatedContractAmount',
          ellipsis: true,
          width: 120
        },
        {
          title: '任务类型',
          align: 'center',
          dataIndex: 'taskType',
          ellipsis: true,
          width: 200
        },
        {
          title: '任务进度状态',
          align: 'center',
          dataIndex: 'taskProgressStatus',
          ellipsis: true,
          width: 200
        },
        {
          title: '生产团队',
          align: 'center',
          dataIndex: 'productTeam_dictText',
          ellipsis: true,
          width: 200
        },
        {
          title: '团队负责人',
          align: 'center',
          dataIndex: 'productTeamLeader_dictText',
          ellipsis: true,
          width: 100
        },
        {
          title: '任务档案编号',
          align: 'center',
          dataIndex: 'taskBillNo',
          ellipsis: true,
          width: 200
        },
        {
          title: '项目负责人',
          align: 'center',
          dataIndex: 'projectLeading_dictText',
          ellipsis: true,
          width: 100
        },
        {
          title: '款项分配金额(元)',
          align: 'center',
          dataIndex: 'taskAllocatePayment',
          ellipsis: true,
          width: 130
        },
        {
          title: statisticYear + '年1月',
          dataIndex: 'yearMonth1',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay01',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName01',
              ellipsis: true,
              width: 180
            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth01',
              ellipsis: true,
              width: 100
            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount01',
              ellipsis: true,
              width: 90
            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount01',
              ellipsis: true,
              width: 90
            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount01',
              ellipsis: true,
              width: 90
            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay01',
              ellipsis: true,
              width: 130
            }
          ]
        },
        {
          title: statisticYear + '年2月',
          dataIndex: 'yearMonth2',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay02',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName02',
              ellipsis: true,
              width: 180
            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth02',
              ellipsis: true,
              width: 100
            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount02',
              ellipsis: true,
              width: 90
            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount02',
              ellipsis: true,
              width: 90
            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount02',
              ellipsis: true,
              width: 90
            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay02',
              ellipsis: true,
              width: 130
            }
          ]
        },
        {
          title: statisticYear + '年3月',
          dataIndex: 'yearMonth3',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay03',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName03',
              ellipsis: true,
              width: 180
            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth03',
              ellipsis: true,
              width: 100
            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount03',
              ellipsis: true,
              width: 90
            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount03',
              ellipsis: true,
              width: 90
            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount03',
              ellipsis: true,
              width: 90
            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay03',
              ellipsis: true,
              width: 130
            }
          ]
        },
        {
          title: statisticYear + '年4月',
          dataIndex: 'yearMonth4',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay04',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName04',
              ellipsis: true,
              width: 180

            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth04',
              ellipsis: true,
              width: 100

            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount04',
              ellipsis: true,
              width: 90

            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount04',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount04',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay04',
              ellipsis: true,
              width: 130

            }
          ]
        },
        {
          title: statisticYear + '年5月',
          dataIndex: 'yearMonth5',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay05',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName05',
              ellipsis: true,
              width: 180

            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth05',
              ellipsis: true,
              width: 100

            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount05',
              ellipsis: true,
              width: 90

            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount05',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount05',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay05',
              ellipsis: true,
              width: 130

            }
          ]
        },
        {
          title: statisticYear + '年6月',
          dataIndex: 'yearMonth6',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay06',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName06',
              ellipsis: true,
              width: 180

            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth06',
              ellipsis: true,
              width: 100

            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount06',
              ellipsis: true,
              width: 90

            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount06',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount06',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay06',
              ellipsis: true,
              width: 130

            }
          ]
        },
        {
          title: statisticYear + '年7月',
          dataIndex: 'yearMonth7',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay07',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName07',
              ellipsis: true,
              width: 180

            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth07',
              ellipsis: true,
              width: 100

            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount07',
              ellipsis: true,
              width: 90

            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount07',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount07',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay07',
              ellipsis: true,
              width: 130

            }
          ]
        },
        {
          title: statisticYear + '年8月',
          dataIndex: 'yearMonth8',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay08',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName08',
              ellipsis: true,
              width: 180

            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth08',
              ellipsis: true,
              width: 100

            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount08',
              ellipsis: true,
              width: 90

            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount08',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount08',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay08',
              ellipsis: true,
              width: 130

            }
          ]
        }, {
          title: statisticYear + '年9月',
          dataIndex: 'yearMonth9',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay09',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName09',
              ellipsis: true,
              width: 180

            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth09',
              ellipsis: true,
              width: 100

            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount09',
              ellipsis: true,
              width: 90

            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount09',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount09',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay09',
              ellipsis: true,
              width: 130

            }
          ]
        }, {
          title: statisticYear + '年10月',
          dataIndex: 'yearMonth10',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay10',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName10',
              ellipsis: true,
              width: 180

            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth10',
              ellipsis: true,
              width: 100

            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount10',
              ellipsis: true,
              width: 90

            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount10',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount10',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay10',
              ellipsis: true,
              width: 130

            }
          ]
        }, {
          title: statisticYear + '年11月',
          dataIndex: 'yearMonth11',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay11',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName11',
              ellipsis: true,
              width: 180

            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth11',
              ellipsis: true,
              width: 100

            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount11',
              ellipsis: true,
              width: 90

            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount11',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount11',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay11',
              ellipsis: true,
              width: 130

            }
          ]
        }, {
          title: statisticYear + '年12月',
          dataIndex: 'yearMonth12',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay12',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName12',
              ellipsis: true,
              width: 180

            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth12',
              ellipsis: true,
              width: 100

            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount12',
              ellipsis: true,
              width: 90

            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount12',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount12',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay12',
              ellipsis: true,
              width: 130

            }
          ]
        }
      ],
      url: {
        list: '/api/erp/omc/payment/erpOmcTaskPaymentPerMonth/newList',
        exportXlsUrl: '/api/erp/omc/payment/erpOmcTaskPaymentPerMonth/export',
        // importExcelUrl: 'api/erp/omc/contractmanager/erpOmcContractManagerFinal/importExcel',
        queryProjectById: '/api/erp/project/report/erpProjectReport/queryById'
      },
      dictOptions: {},
      superFieldList: [],
      bchteRange: 0
    }
  },
  created() {
    this.getSuperFieldList();
  },
  computed: {
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    }
  },
  methods: {
    // 弹出日历和关闭日历的回调
    openChangeOne(status) {
        // status是打开或关闭的状态
        this.yearShowOne = !this.yearShowOne
    },
    // 得到年份选择器的值
    panelChangeOne(value) {
      console.log(moment(value).format('YYYY'));
        this.queryParam.statisticYear = moment(value).format('YYYY')
        this.yearShowOne = !this.yearShowOne
    },
    getDetail(id) {
      this.$router.push({
        path: `/erp/omc/contractmanager/ErpOmcContractManagerFinalListDetail/${id}`
      })
    },
    // tableChangePages(pagination, filters, sorter) {
    //   this.rowSpanPagination = pagination
    //   this.rowSpanPagination.pageNo = pagination.current
    //   this.loadData()
    // },
    async loadData(arg) {
      if (!this.url.list) {
        this.$message.error('请设置url.list属性!')
        return
      }
      // 加载数据 若传入参数1则加载第一页的内容
      if (arg === 1) {
        this.ipagination.current = 1
      }
      var params = this.getQueryParams();// 查询条件
      this.loading = true
      this.dataSource = []
      let res = await getAction(this.url.list, {
        ...params
      })
      this.loading = false
      if (res.success) {
        this.dataSource = res.result ? res.result.records : [];
        if (res.result.total) {
          this.ipagination.total = res.result.total
        } else {
          this.ipagination.total = 0
        }
        // 判断是否当前页没有数据且不为第一页
        if (this.dataSource.length == 0 && this.ipagination.current != 1) {
          this.ipagination.current = this.ipagination.current - 1
          this.loadData(this.ipagination.current - 1);
        }
      } else {
        this.dataSource = []
        this.ipagination.total = 0
        this.$message.warning(res.message)
      }
    },
    onDetail(id) {
      const that = this
      this.$nextTick(() => {
        getAction(this.url.queryProjectById, { id }).then((res) => {
          if (res.success) {
            const model = res.result
            that.$refs.projectModalForm.getDetail(model);
            that.$refs.projectModalForm.title = '项目一览表';
          }
        })
      })
    },
    getSuperFieldList() {
      let fieldList = [];
      fieldList.push({ type: 'string', value: 'handlerId', text: '经办人编号', dictCode: '' })
      fieldList.push({ type: 'string', value: 'handlerDeptId', text: '经办人部门ID', dictCode: '' })
      fieldList.push({ type: 'string', value: 'handlerDeptCode', text: '经办人部门编码', dictCode: '' })
      fieldList.push({ type: 'string', value: 'delFlag', text: '是否已删除', dictCode: '' })
      fieldList.push({ type: 'string', value: 'htbh', text: '合同编号', dictCode: '' })
      fieldList.push({ type: 'int', value: 'htlx', text: '合同类型', dictCode: '' })
      fieldList.push({ type: 'string', value: 'jytd', text: '经营团队', dictCode: '' })
      fieldList.push({ type: 'string', value: 'htmc', text: '合同名称', dictCode: '' })
      fieldList.push({ type: 'string', value: 'xmmc', text: '项目名称', dictCode: '' })
      fieldList.push({ type: 'int', value: 'sfyz', text: '是否用印', dictCode: '' })
      fieldList.push({ type: 'string', value: 'yzdw', text: '业主单位', dictCode: '' })
      fieldList.push({ type: 'string', value: 'qddw', text: '签订单位', dictCode: '' })
      fieldList.push({ type: 'string', value: 'yzlx', text: '印章类型', dictCode: '' })
      fieldList.push({ type: 'int', value: 'yyfs', text: '用印份数', dictCode: '' })
      fieldList.push({ type: 'string', value: 'xmcjr', text: '项目承接人', dictCode: '' })
      fieldList.push({ type: 'int', value: 'glskht', text: '关联收款合同', dictCode: '' })
      fieldList.push({ type: 'date', value: 'qdrq', text: '签订日期' })
      fieldList.push({ type: 'string', value: 'lxr', text: '联系人', dictCode: '' })
      fieldList.push({ type: 'string', value: 'lxfs', text: '联系方式', dictCode: '' })
      fieldList.push({ type: 'int', value: 'yjgsnd', text: '业绩归属年度', dictCode: '' })
      fieldList.push({ type: 'int', value: 'skhte', text: '收款合同额', dictCode: '' })
      fieldList.push({ type: 'date', value: 'fwqx', text: '服务期限' })
      fieldList.push({ type: 'string', value: 'yf', text: '乙方', dictCode: '' })
      fieldList.push({ type: 'string', value: 'bchtedx', text: '本次合同额大写', dictCode: '' })
      fieldList.push({ type: 'string', value: 'skhtedx', text: '收款合同额大写', dictCode: '' })
      fieldList.push({ type: 'string', value: 'skhtmc', text: '收款合同名称', dictCode: '' })
      fieldList.push({ type: 'int', value: 'bchte', text: '本次合同额', dictCode: '' })
      fieldList.push({ type: 'string', value: 'jf', text: '甲方', dictCode: '' })
      fieldList.push({ type: 'string', value: 'xmbh', text: '项目编号', dictCode: '' })
      fieldList.push({ type: 'string', value: 'status', text: '状态', dictCode: '' })
      fieldList.push({ type: 'int', value: 'lx', text: 'lx', dictCode: '' })
      fieldList.push({ type: 'string', value: 'bz', text: 'bz', dictCode: '' })
      fieldList.push({ type: 'string', value: 'yjxx', text: 'yjxx', dictCode: '' })
      fieldList.push({ type: 'string', value: 'xgfj', text: 'xgfj', dictCode: '' })
      this.superFieldList = fieldList
    },
    searchReset() {
      this.queryParam = {}
      this.$set(this.queryParam, 'statisticYear', moment(new Date()).format('YYYY'));
      statisticYear = moment().format('YYYY')
      this.onClearSelected();
      this.columnsChange()
      this.loadData(1);
    },
    searchQuery() {
      this.onClearSelected();
      statisticYear = this.queryParam.statisticYear
      this.columnsChange()
    },
    columnsChange () {
      this.defColumns = [
        // {
        //   title: '序号',
        //   align: 'center',
        //   dataIndex: '',
        //   key: 'rowIndex',
        //   width: 60,
        //   ellipsis: true
        // },
        {
          title: '项目编号',
          align: 'center',
          dataIndex: 'projectFinalNo',
          ellipsis: true,
          width: 200
        },
        {
          title: '项目名称',
          align: 'center',
          dataIndex: 'projectName',
          scopedSlots: { customRender: 'projectName' },
          ellipsis: true,
          width: 220
        },
        {
          title: '业绩归属年度',
          align: 'center',
          dataIndex: 'performanceYear',
          ellipsis: true,
          width: 120
        },
        {
          title: '签订单位',
          align: 'center',
          dataIndex: 'signUnit_dictText',
          ellipsis: true,
          width: 120
        },
        {
          title: '业主单位',
          align: 'center',
          dataIndex: 'ownerUnit_dictText',
          ellipsis: true,
          width: 120
        },
        {
          title: '经营团队',
          align: 'center',
          dataIndex: 'teamName_dictText',
          ellipsis: true,
          width: 200
        },
        {
          title: '团队负责人',
          align: 'center',
          dataIndex: 'manageTeamLeader_dictText',
          ellipsis: true,
          width: 200
        },
        {
          title: '项目承接人',
          align: 'center',
          dataIndex: 'undertaker_dictText',
          ellipsis: true,
          width: 100
        },
        {
          title: '收款合同额(元)',
          align: 'center',
          dataIndex: 'estimatedContractAmount',
          ellipsis: true,
          width: 120
        },
        {
          title: '任务类型',
          align: 'center',
          dataIndex: 'taskType',
          ellipsis: true,
          width: 200
        },
        {
          title: '任务进度状态',
          align: 'center',
          dataIndex: 'taskProgressStatus',
          ellipsis: true,
          width: 200
        },
        {
          title: '生产团队',
          align: 'center',
          dataIndex: 'productTeam_dictText',
          ellipsis: true,
          width: 200
        },
        {
          title: '团队负责人',
          align: 'center',
          dataIndex: 'productTeamLeader_dictText',
          ellipsis: true,
          width: 100
        },
        {
          title: '任务档案编号',
          align: 'center',
          dataIndex: 'taskBillNo',
          ellipsis: true,
          width: 200
        },
        {
          title: '项目负责人',
          align: 'center',
          dataIndex: 'projectLeading_dictText',
          ellipsis: true,
          width: 100
        },
        {
          title: '款项分配金额(元)',
          align: 'center',
          dataIndex: 'taskAllocatePayment',
          ellipsis: true,
          width: 130
        },
        {
          title: statisticYear + '年1月',
          dataIndex: 'yearMonth1',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay01',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName01',
              ellipsis: true,
              width: 180

            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth01',
              ellipsis: true,
              width: 100

            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount01',
              ellipsis: true,
              width: 90

            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount01',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount01',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay01',
              ellipsis: true,
              width: 130

            }
          ]
        },
        {
          title: statisticYear + '年2月',
          dataIndex: 'yearMonth2',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay02',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName02',
              ellipsis: true,
              width: 180

            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth02',
              ellipsis: true,
              width: 100

            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount02',
              ellipsis: true,
              width: 90

            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount02',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount02',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay02',
              ellipsis: true,
              width: 130

            }
          ]
        },
        {
          title: statisticYear + '年3月',
          dataIndex: 'yearMonth3',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay03',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName03',
              ellipsis: true,
              width: 180

            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth03',
              ellipsis: true,
              width: 100

            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount03',
              ellipsis: true,
              width: 90

            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount03',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount03',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay03',
              ellipsis: true,
              width: 130

            }
          ]
        },
        {
          title: statisticYear + '年4月',
          dataIndex: 'yearMonth4',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay04',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName04',
              ellipsis: true,
              width: 180

            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth04',
              ellipsis: true,
              width: 100

            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount04',
              ellipsis: true,
              width: 90

            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount04',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount04',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay04',
              ellipsis: true,
              width: 130

            }
          ]
        },
        {
          title: statisticYear + '年5月',
          dataIndex: 'yearMonth5',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay05',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName05',
              ellipsis: true,
              width: 180

            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth05',
              ellipsis: true,
              width: 100
            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount05',
              ellipsis: true,
              width: 90

            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount05',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount05',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay05',
              ellipsis: true,
              width: 130

            }
          ]
        },
        {
          title: statisticYear + '年6月',
          dataIndex: 'yearMonth6',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay06',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName06',
              ellipsis: true,
              width: 180

            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth06',
              ellipsis: true,
              width: 100

            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount06',
              ellipsis: true,
              width: 90

            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount06',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount06',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay06',
              ellipsis: true,
              width: 130

            }
          ]
        },
        {
          title: statisticYear + '年7月',
          dataIndex: 'yearMonth7',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay07',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName07',
              ellipsis: true,
              width: 180

            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth07',
              ellipsis: true,
              width: 100

            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount07',
              ellipsis: true,
              width: 90

            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount07',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount07',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay07',
              ellipsis: true,
              width: 130

            }
          ]
        },
        {
          title: statisticYear + '年8月',
          dataIndex: 'yearMonth8',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay08',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName08',
              ellipsis: true,
              width: 180

            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth08',
              ellipsis: true,
              width: 100

            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount08',
              ellipsis: true,
              width: 90

            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount08',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount08',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay08',
              ellipsis: true,
              width: 130

            }
          ]
        }, {
          title: statisticYear + '年9月',
          dataIndex: 'yearMonth9',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay09',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName09',
              ellipsis: true,
              width: 180

            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth09',
              ellipsis: true,
              width: 100

            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount09',
              ellipsis: true,
              width: 90

            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount09',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount09',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay09',
              ellipsis: true,
              width: 130

            }
          ]
        }, {
          title: statisticYear + '年10月',
          dataIndex: 'yearMonth10',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay10',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName10',
              ellipsis: true,
              width: 180

            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth10',
              ellipsis: true,
              width: 100

            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount10',
              ellipsis: true,
              width: 90

            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount10',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount10',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay10',
              ellipsis: true,
              width: 130

            }
          ]
        }, {
          title: statisticYear + '年11月',
          dataIndex: 'yearMonth11',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay11',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName11',
              ellipsis: true,
              width: 180

            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth11',
              ellipsis: true,
              width: 100

            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount11',
              ellipsis: true,
              width: 90

            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount11',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount11',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay11',
              ellipsis: true,
              width: 130

            }
          ]
        }, {
          title: statisticYear + '年12月',
          dataIndex: 'yearMonth12',
          children: [
            {
              title: '应收金额(元)',
              align: 'center',
              dataIndex: 'needPay12',
              ellipsis: true,
              width: 100
            },
            {
              title: '款项名称',
              align: 'center',
              dataIndex: 'planName12',
              ellipsis: true,
              width: 180

            },
            {
              title: '应收时间',
              align: 'center',
              dataIndex: 'needPayMonth12',
              ellipsis: true,
              width: 100

            },
            {
              title: '已回款(元)',
              align: 'center',
              dataIndex: 'alreadyPayAmount12',
              ellipsis: true,
              width: 90

            },
            {
              title: '未回款(元)',
              align: 'center',
              dataIndex: 'notPayAmount12',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票(元)',
              align: 'center',
              dataIndex: 'invoiceOpenedAmount12',
              ellipsis: true,
              width: 90

            },
            {
              title: '已开票未回款(元)',
              align: 'center',
              dataIndex: 'openedButNotPay12',
              ellipsis: true,
              width: 130

            }
          ]
        }
      ]
      this.initColumns()
      this.loadData(1)
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
